package edu.unc.comp410.colemangeer.model;

public class ShippingInfo {

	private final String streetAddress;
	private final String city;
	private final String stateAbbrev;
	private final String country;
	private final String zipCode;

	private TaxRegion taxRegion;
	private TaxCountry taxCountry = TaxCountry.USA; //there aren't any non-American
	// customers listed in the Customer table

	public ShippingInfo(
			String streetAddress,
			String city,
			String stateAbbrev,
			String country,
			String zipCode) {
		
		this.city = city;
		this.country = country;
		this.stateAbbrev = stateAbbrev;
		this.streetAddress = streetAddress;
		this.zipCode = zipCode;
		
		try {
			this.taxRegion = TaxRegion.determineTaxRegion(stateAbbrev);
			this.taxCountry = TaxCountry.determineTaxCountry(country);
		} catch (TaxRuleException e) {
			throw new IllegalArgumentException();
		}
		
	}

	public TaxRegion getTaxRegion() {
		return taxRegion;
	}

	public void setTaxRegion(TaxRegion taxRegion) {
		this.taxRegion = taxRegion;
	}

	public TaxCountry getTaxCountry() {
		return taxCountry;
	}

	public void setTaxCountry(TaxCountry taxCountry) {
		this.taxCountry = taxCountry;
	}
}
